package patterns.command;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lenovo on 2016/11/30 0030.
 * 命令的调用者
 */
public class Broker {
    private List<IOrder> orders = new ArrayList<>();

    public void takeOrder(IOrder order) {
        orders.add(order);
    }
    //执行指令
    public void placeOrders() {
        for (IOrder order : orders) {
            order.execute();
        }
        orders.clear();
    }
}
